import { getToken } from '@/utils/token.js'
// 封装接口方法
import axios from '@/utils/request.js'
// 获取所有频道列表
export const getChannelListApi = () => axios({ url: '/v1_0/channels' })
// 登录
export const userLogin = ({ mobile, code }) => axios({
  url: '/v1_0/authorizations',
  method: 'POST',
  data: {
    mobile,
    code
  }
})

export const userchannel = () => axios({
  url: '/v1_0/user/channels',
  headers: {
    Authorization: `Bearer ${getToken()}`
  }
})

export const getnews = (channel_id) => axios({
  url: '/v1_0/articles',
  headers: {
    Authorization: `Bearer ${getToken()}`
  },
  params: {
    channel_id,
    timestamp: new Date()
  }
})
